<?php

/**
 * RedCross_Gateway_Base_Diploma
 *
 * @property integer $id
 * @property string $description
 * @property string $file_name
 * @property timestamp $upload_date
 * @property RedCross_Gateway_Base_Member $Member
 *
 * @package    RedCross_Gateway_Base
 * @subpackage Diploma
 * @author     Håvard Lindset <lindset@gmail.com
 * @version    1.0
 */

class RedCross_Gateway_Base_Diploma extends Doctrine_Record {
    public function setTableDefinition() {
        $this->setTableName('diploma');
        $this->hasColumn('id', 'integer', 4, array(
            'type' => 'integer',
            'primary' => true,
            'length' => '4',
        ));
        $this->hasColumn('description', 'string', 256, array(
            'type' => 'string',
            'notnull' => 'true',
            'length' => 256,
        ));
        $this->hasColumn('file_name', 'string', 128, array(
            'type' => 'string',
            'notnull' => 'true',
            'length' => 128,
        ));
        $this->hasColumn('member_id', 'integer', 4, array(
            'type' => 'integer',
            'length' => '4',
        ));
        $this->hasColumn('upload_date', 'teimstamp', null, array(
            'type' => 'timestamp',
        ));
    }

    public function setUp()
    {
        parent::setUp();

        $this->hasOne('RedCross_Gateway_Base_Member as Member', array(
            'local' => 'member_id',
            'foreign' => 'id'));

        $timestampable0 = new Doctrine_Template_Timestampable(array(
            'created' => array(
                'name' => 'upload_date',
                'type' => 'timestamp',
                'format' => 'Y-m-d H:i:s',
            ),
            'updated' => array('disabled' => true)
        ));
        $this->actAs($timestampable0);
    }
}

?>
